package cn.ronghuanet.auth.service.impl;

import cn.ronghuanet.auth.domain.Role;
import cn.ronghuanet.auth.dto.RoleDTO;
import cn.ronghuanet.auth.mapper.RoleMapper;
import cn.ronghuanet.auth.query.RoleQuery;
import cn.ronghuanet.auth.service.IRoleService;
import cn.ronghuanet.base.service.impl.BaseServiceImpl;
import cn.ronghuanet.base.util.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
@Service
public class RoleServiceImpl extends BaseServiceImpl<Role> implements IRoleService {
    @Autowired
    private RoleMapper mapper;

    @Transactional
    @Override
    public void setRolePermission(RoleDTO roleDTO) {
        mapper.deleteAll(roleDTO.getId());
        mapper.setRolePermission(roleDTO);
    }

    @Override
    public List<String> getRolePermission(Long id) {
        return mapper.getRolePermission(id);
    }
}
